#ifndef CLIENT_H
#define CLIENT_H


#include <QWidget>
#include <QSqlDatabase>
#include <QDebug>
#include <QSqlQuery>
#include <QSqlError>
#include <QMessageBox>
#include <QMovie>
#include <QFile>
#include"client2.h"
#include"client3.h"


namespace Ui {
class Client;
}

class Client : public QWidget
{
    Q_OBJECT

public:
    explicit Client(QWidget *parent = nullptr);
    ~Client();
    Ui::Client *ui;

private slots:
    //显示密码
    void on_checkBox_2_clicked();
    //记住密码
    void on_checkBox_clicked();
    //登录
    void on_pushButton_clicked();
    //注册
    void on_pushButton_2_clicked();


private:

};

static bool createConnection2()
{
    QSqlDatabase db1 = QSqlDatabase::addDatabase("QSQLITE", "connection1"); //创建指定连接名称的数据库
    db1.setDatabaseName("data.db"); //设置数据库名称
    if (!db1.open()) { //打开数据库
        qDebug() << "cannot open the database";
        if (QFile::exists("data.db")) {
            return false;
        } else {
            QSqlQuery query1(db1); //对指定连接的数据库执行sql语句
            query1.exec("create table data1(id varchar(20),mima varchar(20))");
            query1.exec("insert into data1(id,mima) values('123456','123456')");
            query1.exec("insert into data1(id,mima) values('654321','654321')");
            query1.exec("insert into data1(id,mima) values('4444','4444')");
            return true;
        }
    }
    return true;
}



#endif // CLIENT_H
